package demo;

import java.util.Scanner;

public class AllTest
{
    public static void main(String[] args)
    {
        //完成健康计算器//
        //1.用户输入身高，体重，年龄，性别
        //2.计算BMI
        //3.计算bmr
        Scanner sc = new Scanner(System.in);
        System.out.println("身高：");
        double height = sc.nextDouble();
        System.out.println("体重：");
        double weight = sc.nextDouble();
        System.out.println("年龄：");
        int age = sc.nextInt();
        System.out.println("性别:");
        String sex = sc.next();
        double bmi = calcBMI(weight,height);
        System.out.println("BMI：" + bmi);
        double bmr = calcbrm(height,weight,sex,age);
        System.out.println("bmr:" + bmr);


    }
    public static double calcBMI(double weight,double height)
    {
        double bmi = weight/((height/100)*(height/100));
        return bmi;
    }

    public static double calcbrm(double height,double weight,String sex,int age)
    {
        double bmr = 0;
        if("男".equals(sex))
        {
            bmr = 66 + (13.7 * weight) + (5 * height) - (6.8 * age);
            return bmr;
        }
        else
        {
            bmr = 655 + (9.6 * weight) + (1.8 * height) - (4.7 * age);
            return bmr;
        }

    }

}
